<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <!-- import CSS -->
    <link rel="stylesheet" href="https://cdn.staticfile.org/element-ui/2.15.9/theme-chalk/index.css">
    <style>
        .el-header{
            width: 100%;
            background-color: #96b1f1;

        }
        .el-main{
            border:  1px solid black;
        }
        .el-aside{
            background-color: yellow;

        }
        .el-footer{
            background-color: rgba(27, 27, 31, 0.97);
            width: 100%;
            margin-bottom: 0;
            position: fixed;
        }
        body{
            margin: 0;
        }
    </style>
</head>
<body>
<div id="app">
    <el-container>
        <el-header style="padding: 0;">
            <h1 ALIGN="center">欢迎使用权限管理系统
                <el-button style="float: right;">退出登录</el-button></h1>

        </el-header>

        <el-container>
            <el-aside ><el-menu
                    class="el-menu-vertical-demo"
                    @open="handleOpen"
                    @close="handleClose"
                    @select="handleSelect">
                <caption></caption>
                <el-submenu index="1" >
                    <template slot="title">
                        <i class="el-icon-s-flag"></i>
                        <span>用户表</span>
                    </template>
                    <template slot="title"></template>
                    <el-menu-item index="1-1">用户表</el-menu-item>

                </el-submenu>
                </el-submenu>

                <el-submenu index="2">
                    <template slot="title">
                        <i class="el-icon-picture-outline"></i>
                        <span>角色表</span>
                    </template>
                    <template slot="title"></template>
                    <el-menu-item index="2-1">角色用户联系表</el-menu-item>
                    <el-menu-item index="2-2">角色表</el-menu-item>
                </el-submenu>
                </el-submenu>

                <el-submenu index="3">
                    <template slot="title">
                        <i class="el-icon-shopping-cart-2"></i>
                        <span>权限表</span>
                    </template>
                    <template slot="title"></template>
                    <el-menu-item index="3-1">角色权限联系表</el-menu-item>
                    <el-menu-item index="3-2">权限表</el-menu-item>
                </el-submenu>
                </el-submenu>
            </el-menu>
            </el-aside>

            <el-container>
                <el-main> <el-table v-if="f=='1-1'"
                                    :data="arr"
                                    style="width: 100%">
                    <el-table-column
                            prop="id"
                            label="编号"
                            width="180">
                    </el-table-column>
                    <el-table-column
                            prop="name"
                            label="用户名"
                            width="180">
                    </el-table-column>
                    <el-table-column label="操作">
                        <template slot-scope="scope">
                            <el-button
                                    size="mini"
                                    type="primary"
                                    @click="handleDelete(scope.$index, scope.row)">增加</el-button>
                            <el-button
                                    size="mini"
                                    type="danger"
                                    @click="handleDelete(scope.$index, scope.row)">删除</el-button>
                            <el-button
                                    size="mini"
                                    type="warning"
                                    @click="handleDelete(scope.$index, scope.row)">修改</el-button>
                            <el-button
                                    size="mini"
                                    type="info"
                                    @click="handleDelete(scope.$index, scope.row)">查询</el-button>
                    </template>
                    </el-table-column>
                </el-table>

                    <el-table v-if="f=='2-1'"
                              :data="arr1"
                              style="width: 100%">
                        <caption>表</caption>
                        <el-table-column
                                prop="id"
                                label="编号"
                                width="180">
                        </el-table-column>
                        <el-table-column
                                prop="name"
                                label="角色名称"
                                width="180">
                        </el-table-column>
                        <el-table-column label="操作">
                            <template slot-scope="scope">
                                <el-button
                                        size="mini"
                                        type="primary"
                                        @click="handleDelete(scope.$index, scope.row)">增加</el-button>
                                <el-button
                                        size="mini"
                                        type="danger"
                                        @click="handleDelete(scope.$index, scope.row)">删除</el-button>
                                <el-button
                                        size="mini"
                                        type="warning"
                                        @click="handleDelete(scope.$index, scope.row)">修改</el-button>
                                <el-button
                                        size="mini"
                                        type="info"
                                        @click="handleDelete(scope.$index, scope.row)">查询</el-button>
                            </template>
                        </el-table-column>
                    </el-table>

                    <el-table v-if="f=='3-1'"
                              :data="arr2"
                              style="width: 100%">
                        <caption>表</caption>
                        <el-table-column
                                prop="id"
                                label="编号"
                                width="180">
                        </el-table-column>
                        <el-table-column
                                prop="name"
                                label="权限名称"
                                width="180">
                        </el-table-column>
                        <el-table-column label="操作">
                            <template slot-scope="scope">
                                <el-button
                                        size="mini"
                                        type="primary"
                                        @click="handleDelete(scope.$index, scope.row)">增加</el-button>
                                <el-button
                                        size="mini"
                                        type="danger"
                                        @click="handleDelete(scope.$index, scope.row)">删除</el-button>
                                <el-button
                                        size="mini"
                                        type="warning"
                                        @click="handleDelete(scope.$index, scope.row)">修改</el-button>
                                <el-button
                                        size="mini"
                                        type="info"
                                        @click="handleDelete(scope.$index, scope.row)">查询</el-button>
                            </template>
                        </el-table-column>
                    </el-table>
                    <el-table v-if="f=='2-2'"
                              :data="arr3"
                              style="width: 100%">
                        <caption>表</caption>
                        <el-table-column
                                prop="u_id"
                                label="用户id"
                                width="180">
                        </el-table-column>
                        <el-table-column
                                prop="r_id"
                                label="角色id"
                                width="180">
                        </el-table-column>
                        <el-table-column label="操作">
                            <template slot-scope="scope">
                                <el-button
                                        size="mini"
                                        type="primary"
                                        @click="handleDelete(scope.$index, scope.row)">增加</el-button>
                                <el-button
                                        size="mini"
                                        type="danger"
                                        @click="handleDelete(scope.$index, scope.row)">删除</el-button>
                                <el-button
                                        size="mini"
                                        type="warning"
                                        @click="handleDelete(scope.$index, scope.row)">修改</el-button>
                                <el-button
                                        size="mini"
                                        type="info"
                                        @click="handleDelete(scope.$index, scope.row)">查询</el-button>
                            </template>
                        </el-table-column>
                    </el-table>
                    <el-table v-if="f=='3-2'"
                              :data="arr4"
                              style="width: 100%">
                        <caption>表</caption>
                        <el-table-column
                                prop="r_id"
                                label="角色id"
                                width="180">
                        </el-table-column>
                        <el-table-column
                                prop="M_id"
                                label="权限id"
                                width="180">
                        </el-table-column>
                        <el-table-column label="操作">
                            <template slot-scope="scope">
                                <el-button
                                        size="mini"
                                        type="primary"
                                        @click="handleDelete(scope.$index, scope.row)">增加</el-button>
                                <el-button
                                        size="mini"
                                        type="danger"
                                        @click="handleDelete(scope.$index, scope.row)">删除</el-button>
                                <el-button
                                        size="mini"
                                        type="warning"
                                        @click="handleDelete(scope.$index, scope.row)">修改</el-button>
                                <el-button
                                        size="mini"
                                        type="info"
                                        @click="handleDelete(scope.$index, scope.row)">查询</el-button>
                            </template>
                        </el-table-column>
                    </el-table>


                </el-main>
            </el-container>
        </el-container>
        <el-container>
            <el-footer>
            </el-footer>
        </el-container>
    </el-container>
</div>
</body>
<!-- import Vue before Element -->
<script src="https://cdn.staticfile.org/vue/2.6.14/vue.min.js"></script>
<!-- import JavaScript -->
<script src="https://cdn.staticfile.org/element-ui/2.15.9/index.min.js"></script>
<script>
   let v = new Vue({
        el: '#app',
        data: function() {
            return {
                f:'1',
                arr:[{id:1,name:'唐僧'},{id:2,name:'孙悟空'}],
                arr1:[{id:1,name:'管理员'},{id:2,name:'游客'}],
                arr2:[{id:1,name:'浏览'},{id:2,name:'发帖'}],
                arr3:[{u_id:1,r_id:1},{u_id:2,r_id:1}],
                arr4:[{r_id:1,M_id:2},{r_id:2,M_id:2}],

            }
        },
       methods:{
           handleSelect(key, keyPath) {
              // v.$message(key+","+keyPath);
               if(!(key==1||key==2||key==3)){
                   v.f=key;
               }
           },
           handleOpen(key, keyPath) {
               v.$message(key+","+keyPath);
           },
           handleClose(key, keyPath) {
               v.$message(key+","+keyPath);
           }
       }
    })
</script>
</html>